In [1]:
%matplotlib inline
from ggplot import *
In [2]:
qplot(diamonds.price)
Out[2]:
qplot
can also plot numpy arrays and lists. To do this, just pass in the array or list to the qplot
function as you would with a pandas Series.
In [3]:
import numpy as np
x = np.random.normal(0, 1, 1000)
qplot(x)
Out[3]:
In [4]:
ggplot(diamonds, aes(x='price')) + geom_histogram()
Out[4]:
geom_histogram
makes it easier to control other aesthetics of your plot. For example if you wanted the bars to be different colors based on the cut
of the diamond, you could do that by adding a fill='cut'
aesthetic to your base layer.
In [5]:
ggplot(diamonds, aes(x='price', fill='cut')) + geom_histogram()
Out[5]:
In [ ]: